package com.ruoyi.baseData.controller;

import com.ruoyi.baseData.domain.dto.MaterialTypeDto;
import com.ruoyi.baseData.service.MaterialTypeService;
import com.ruoyi.common.core.domain.R;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/materialType")
public class MaterialTypeController {
    @Autowired
    MaterialTypeService materialTypeService;

    @PostMapping("/getMaterialTypeByPage")
    public R export(@RequestBody MaterialTypeDto materialDto)
    {
        return R.ok(materialTypeService.getMaterialTypeByPage(materialDto));
    }

    @PostMapping("/addMaterialType")
    public R addTest(@RequestBody MaterialTypeDto materialDto){
        materialTypeService.addMaterialType(materialDto);
        return R.ok("添加成功");
    }

    @PostMapping("/delMaterialType")
    public R delTest(@RequestBody MaterialTypeDto materialDto){
        materialTypeService.delMaterialType(materialDto);
        return R.ok("删除成功");
    }

    @PostMapping("/updateMaterialType")
    public R updateTest(@RequestBody MaterialTypeDto materialDto){
        materialTypeService.updateMaterialType(materialDto);
        return R.ok("锁定成功");
    }

}
